package com.weishi.project.sport.world.controller;

import com.weishi.framework.web.controller.BaseController;
import com.weishi.framework.web.domain.AjaxResult;
import com.weishi.project.sport.world.service.WorldService;
import com.weishi.project.training.domain.WorldAchievement;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(value = "运动员端--世界成绩", description = "运动员端--世界成绩")
@RestController
@CrossOrigin("*")//解决移动端跨域
@RequestMapping("/world/")
public class WorldController extends BaseController {

    /**
     * 世界成绩接口
     */
    @Autowired
    private WorldService worldService;


    @ApiOperation("运动员 -- 世界成绩只查询水上专项 2000 米 ， 根据不同艇只，男女 ，来查询")
    @RequestMapping(value = "getWorldAchievement", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult getWorldAchievement(String sex)
    {
        return worldService.getWorldAchievement(currentLoginSportsman().getId() , sex);
    }


    @ApiOperation("运动员 -- 新增世界成绩")
    @RequestMapping(value = "addWorldAchievement", method = RequestMethod.POST)
    @ResponseBody
    public AjaxResult addWorldAchievement(WorldAchievement worldAchievement)
    {
        return worldService.addWorldAchievement(worldAchievement);
    }








}
